home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / boosters.arc / HEAPAT.ASM < prev    next >
Assembly Source File  |  1985-10-06  |  2KB  |  82 lines

  1. ;**************************************************
  2. ;
  3. ;       Procedure HEAPAT(        Page : HeapBuf;
  4. ;                         X1,Y1,X2,Y2 : Integer;
  5. ;                           Attribute : Byte );
  6. ;
  7. ;       Sets heap attributes on Page [n]
  8. ;              for the block at X1,Y1 (upper left)
  9. ;                               X2,Y2 (lower right)
  10. ;
  11. ;**************************************************
  12. HEAPAT  proc    near
  13.         push    bp
  14.     mov    bp,sp
  15.     push    ds
  16. ;
  17. ;
  18. ;*** Compute number of lines to move
  19. ;
  20.     mov    ax,[bp+10]    ; value of Y1 into AX
  21.     mov    dx,[bp+06]    ; value of Y2 into CX
  22.         sub     dx,ax           ; DX = Y2 - Y1
  23.     inc    dx        ; DX = Number of lines
  24.     push    dx
  25. ;
  26. ;
  27. ;*** Compute length of each move
  28. ;
  29.     mov    ax,[bp+12]    ;  X1
  30.     mov    cx,[bp+08]    ;  X2
  31.     sub    cx,ax        ;  CX = X2 - X1
  32.     inc    cx        ;  CX = num WORDS/line
  33.     push    cx
  34. ;
  35. ;*** Get Page [n] address on Heap
  36. ;
  37.     mov    di,[bp+14]
  38.     mov    ax,[bp+16]
  39.     mov    es,ax
  40. ;
  41. ;*** Compute upper left offset of block
  42. ;
  43.     add    di,[bp+10]    ;  Add Y1 to DI
  44.         dec     di              ;  (Y1-1)
  45.     mov    dx,di        ;  Save in DX
  46.     mov    cl,7
  47.     shl    dx,cl        ;  (Y1-1) * 128
  48.     mov    cl,5
  49.     shl    di,cl        ;  (Y1-1) *  32
  50.     add    di,dx        ;  (Y1-1) * 160
  51.     mov    ax,[bp+12]    ;  X1 into AX
  52.     dec    ax        ;  (X1-1)
  53.     shl    ax,1        ;  2 * (X1-1)
  54.     add    di,ax        ;  offset
  55.     inc    di        ; odd location
  56. ;
  57.     pop    cx        ; Num words/line
  58.     pop    dx        ; Num lines to blank
  59. ;
  60. ;*** Set attribute byte for given block
  61. ;
  62.     mov    ax,[bp+04]    ; attribute
  63.     cld
  64. AGAIN:    push    cx
  65. DO:    stosb
  66.     inc    di
  67.     loop    do
  68. ;
  69.     pop    cx
  70.     dec    dx
  71.     jz    DONE2
  72.     add    di,160
  73.     sub    di,cx
  74.     sub    di,cx
  75.     jmp    AGAIN
  76. ;
  77. DONE2:  pop     ds
  78.         mov     sp,bp
  79.         pop     bp
  80.     ret    14
  81. HEAPAT  endp
  82.